﻿using Abp.Application.Services;
using Abp.Domain.Repositories;
using Batman.Jianbei.Forum.Core.Domains.Dicts;
using System.Linq;

namespace Batman.Jianbei.Forum.Services.Dicts
{
    public class PumpBrandManager : ApplicationService
    {
        public IRepository<PumpBrand, string> Repository { get; set; }

        public IRepository<PumpModel, string> PumpModelRepo { get; set; }

        /// <summary>
        /// 是否可以删除胰岛素泵品牌
        /// </summary>
        /// <param name="pumpBrandId">胰岛素泵品牌</param>
        /// <returns></returns>
        public bool CanDelete(string pumpBrandId)
        {
            var saleInfoExists = PumpModelRepo.GetAll().Any(t => t.PumpBrandId == pumpBrandId);

            if (saleInfoExists)
                return false;

            return true;
        }
    }
}
